package com.wanmait.myhouse.webController;

import com.wanmait.myhouse.dao.UserDAO;
import com.wanmait.myhouse.util.DBHelper;
import com.wanmait.myhouse.vo.User;
import org.apache.commons.dbutils.QueryRunner;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
@RequestMapping("web")
public class WebPassController {
    @GetMapping("pass")
    public String pass(String userName, Model model){
        UserDAO userDAO = new UserDAO();
        User users= userDAO.userByName(userName);
        model.addAttribute("ser",users);
        return "web/pass";
    }
    @PostMapping("update")
    public String update(User user){
        UserDAO userDAO = new UserDAO();
        userDAO.updatePass(user);
        return "redirect:/web/login";
    }
}
